clean_add_addresses_main<-function(years_bac,years_adm){
  ########################BAC########################################
  #Add the addresses and GPS coordinates of schools (hs in bac, hs and ms in adm)
  setwd(wd_data_final)
  hs_bac<-readRDS("hs_bac_locations") %>% select(judet,school_name,school_name_town,address,lat,lng,match_type)
  colnames(hs_bac)<-paste0(colnames(hs_bac),".hs_bac")
  hs_adm<-readRDS("hs_adm_locations") %>% select(judet,school_name,school_name_town,address,lat,lng,match_type)
  colnames(hs_adm)<-paste0(colnames(hs_adm),".hs_adm")
  ms_adm<-readRDS("ms_adm_locations") %>% select(judet,school_name,school_name_town,address,lat,lng,match_type)
  colnames(ms_adm)<-paste0(colnames(ms_adm),".ms_adm")
  print("Bac Data")
  
  setwd(wd_data_intermediate)
  for (i in years_bac){
    print(i)
    data_temp<-readRDS(paste("data_bac_raw",i,".rds",sep=""))
    data_temp<-base::merge(data_temp,hs_bac,by.x=c("judet_bac","unitate_de_invatamant"),by.y=c("judet.hs_bac","school_name.hs_bac"),all.x=T)
    saveRDS(data_temp,paste0("data_bac_raw_gps_",i))
    num<-sum(!is.na(data_temp$lat.hs_bac))
    denom<-sum(length(data_temp$lat.hs_bac))
    stat<-num/denom*100
    print(paste0(stat, "% of observations now have GPS coordinates."))
  }
  
  print("Adm Data")
  for (i in years_adm){
    print(i)
   # data_temp<-readRDS(paste("data_adm_raw",i,".rds",sep=""))
    data_temp<-readRDS(paste("data_adm_hs_ms_siiir_",i,".rds",sep=""))
    data_temp<-base::merge(data_temp,hs_adm,by.x=c("judet_adm","liceu_repartizat"),by.y=c("judet.hs_adm","school_name.hs_adm"),all.x=T)
    data_temp<-base::merge(data_temp,ms_adm,by.x=c("judet_ms","scoala_de_provenienta"),by.y=c("judet.ms_adm","school_name.ms_adm"),all.x=T)
    saveRDS(data_temp,paste0("data_adm_raw_gps_",i))
    
    num<-sum(!is.na(data_temp$lat.hs_adm))
    denom<-sum(length(data_temp$lat.hs_adm))
    stat<-num/denom*100
    print(paste0(stat, "% of observations now have GPS coordinates for high schools."))
    
    num<-sum(!is.na(data_temp$lat.ms_adm))
    denom<-sum(length(data_temp$lat.ms_adm))
    stat<-num/denom
    print(paste0(stat*100, "% of observations now have GPS coordinates for middle schools."))
  }
  

}